home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / unix / mk-local_lim.c < prev    next >
C/C++ Source or Header  |  1993-06-30  |  3KB  |  119 lines

  1. /* Copyright (C) 1993 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #include <stdio.h>
  20. #include <sys/types.h>
  21.  
  22. #ifdef HAVE_SYS_PARAM_H
  23. #include <sys/param.h>
  24. #endif
  25.  
  26. #ifdef HAVE_LIMITS_H
  27. #include <limits.h>
  28. #endif
  29.  
  30. #ifdef HAVE_SYS_LIMITS_H
  31. #include <sys/limits.h>
  32. #endif
  33.  
  34. /* Generate local_lim.h from the values defined in the system's headers.  */
  35.  
  36. struct param
  37.   {
  38.     char *name;
  39.     int value;
  40.   };
  41.  
  42. static struct param params[] =
  43.   {
  44.  
  45. #if !defined (ARG_MAX) && defined (NCARGS)
  46. #define ARG_MAX NCARGS
  47. #endif
  48. #ifdef ARG_MAX
  49.     { "ARG_MAX", ARG_MAX },
  50. #endif
  51.  
  52. #if !defined (CHILD_MAX) && defined (MAXUPRC)
  53. #define CHILD_MAX MAXUPRC
  54. #endif
  55. #ifdef CHILD_MAX
  56.     { "CHILD_MAX", CHILD_MAX },
  57. #endif
  58.  
  59. #if !defined (LINK_MAX) && defined (MAXLINK)
  60. #define LINK_MAX MAXLINK
  61. #endif
  62. #ifdef LINK_MAX
  63.     { "LINK_MAX", LINK_MAX },
  64. #endif
  65.  
  66. #if !defined (OPEN_MAX) && defined (NOFILE)
  67. #define OPEN_MAX NOFILE
  68. #endif
  69. #ifdef OPEN_MAX
  70.     { "OPEN_MAX", OPEN_MAX },
  71. #endif
  72.  
  73. #if !defined (MAX_CANON) && defined (CANBSIZ)
  74. #define MAX_CANON CANBSIZ
  75. #endif
  76. #ifdef MAX_CANON
  77.     { "MAX_CANON", MAX_CANON },
  78. #endif
  79.  
  80. #if !defined (NAME_MAX) && defined (MAXNAMLEN)
  81. #define NAME_MAX MAXNAMLEN
  82. #endif
  83. #ifndef NAME_MAX
  84. #define NAME_MAX    255    /* XXX ? */
  85. #endif
  86.     { "NAME_MAX", NAME_MAX },
  87.  
  88. #if !defined (PATH_MAX) && defined (MAXPATHLEN)
  89. #define PATH_MAX MAXPATHLEN
  90. #endif
  91. #ifdef PATH_MAX
  92.     { "PATH_MAX", PATH_MAX },
  93. #endif
  94.  
  95.     { NULL, 0 }
  96.   };
  97.  
  98. int
  99. main()
  100. {
  101.   extern char *ctime ();
  102.   extern time_t time ();
  103.   time_t now = time ((time_t *) NULL);
  104.   register struct param *p;
  105.  
  106.   if (! params[0].name)
  107.     /* We have no information to give, so let the caller know.  */
  108.     exit (1);
  109.  
  110.   printf ("\
  111. /* Implementation-specific limits.\n\
  112.    Generated at %.24s.  */\n\n", ctime (&now));
  113.  
  114.   for (p = params; p->name != NULL; ++p)
  115.     printf ("#define %s %d\n", p->name, p->value);
  116.  
  117.   exit (0);
  118. }
  119.